mui.init({

});
var brushing_data;
mui.plusReady(function () {
    var self = plus.webview.currentWebview();
    var re = self.re;
    var dataID = self.dataID;
    var type = self.type;

    brushing_data = new Vue({
        el: '#jiexi_box',
        data: {
            type: '',
            questionDetail: '',
            cailiaoTab: 0,
            cailiaoCate: 'cailiao',
        },
        mounted() {
            this.get_kdetails();
        },

        methods: {
            get_kdetails: function () {
                showWatting();
                var api_host = plus.storage.getItem('HOST_URL');
                mui.ajax({
                    url: api_host + '/api/questionbank/choice_question/getOnesCategoryQuestionDetails',
                    data: {
                        're': re,
                        'id': dataID,
                        'type': type,
                    },
                    headers:{'User-Token':plus.storage.getItem('UserToken')},
                    timeout:3000,
                    dataType: 'json',
                    type: 'get',
                    success: function (msg) {
                        if (msg.code == 1) {
                            brushing_data.questionDetail = msg.data;
                            brushing_data.type = msg.data.type;
                        } else if (msg.code == 0) {
                            mui.toast(msg.msg, {duration: '200',type: 'div'});
                            setTimeout(function () {
                                mui.back();
                            }, 1500)
                        }
                    },
                    error: function (xhr, type, errorThrown) {
                        mui.toast('加载失败!', {duration: '200',type: 'div'});
                    },
                    complete: function () {
                        plus.nativeUI.closeWaiting();
                    }
                });
            },
            select_cailiaoTab: function (e) {
                this.cailiaoCate = e.target.getAttribute('tabCat');
                if (e.target.getAttribute('tabCat') == 'wenti') {
                    this.cailiaoTab = e.target.getAttribute('qINdex');
                } else if (e.target.getAttribute('tabCat') == 'cailiao') {
                    this.cailiaoTab = e.target.getAttribute('cINdex');
                }
            },
        }
    })
})